package com.le.tester.javaThink.fifth.chapter13_FuncProgramming;

import java.util.function.IntSupplier;

/**
 * createTime：2021/8/6 14:19
 * description：共享了对象的变量
 */
public class SharedStorage {
    public static void main(String[] args) {
        Closure1 closure1 = new Closure1();
        //是否共享了对象的变量
        IntSupplier f1 = closure1.makeFun(0);
        IntSupplier f2 = closure1.makeFun(0);
        IntSupplier f3 = closure1.makeFun(0);
        System.out.println(f1.getAsInt());
        System.out.println(f2.getAsInt());
        System.out.println(f3.getAsInt());

        //输出的结果
        //0
        //1
        //2
        //类变量共享了


        //如果只是方法中的变量
    }
}
